const searchMatrix = (matrix, target) => {
  if (matrix.length == 0) return false;
  let x = matrix.length - 1;
  y = 0;
  while (x >= 0 && y <= matrix[0].length - 1) {
    if (matrix[x][y] > target) {
      x--;
    } else if (matrix[x][y] < target) {
      y++;
    } else {
      return true;
    }
  }
  return false;
};
